﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using stwh_Common;

namespace stwh_Web.Handler
{
    /// <summary>
    /// speech 的摘要说明
    /// </summary>
    public class speech : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            try
            {
                string type = context.Request["type"];
                if (type == "0")
                {
                    string text = context.Request["text"];
                    if (!string.IsNullOrEmpty(text)) context.Response.Write(new SpeechHelper().SpeakText(text));
                    else context.Response.Write("没有内容");
                }
                else if (type == "1")
                {
                    new SpeechHelper().Pause();
                    context.Response.Write("1");
                }
            }
            catch (Exception)
            {
                context.Response.Write("error");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}